# 
# Copyright (C) 2006-2009 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk

PKG_NAME:=sshguard
PKG_VERSION:=1.5rc4

#PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)$(PKG_RELEASE).tar.bz2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=@SF/$(PKG_NAME)

include $(INCLUDE_DIR)/package.mk

define Package/sshguard
  SECTION:=Testing
  CATEGORY:=Testing
  SUBMENU:=Monitor
  DEPENDS:=+libpthread
  TITLE:=sshguard blocks the IP address of the bad guy with a firewall rule.
  URL:=http://sshguard.sourceforge.net/
endef

define Build/Prepare
	$(call Build/Prepare/Default)
#	$(CP) -a * $(PKG_BUILD_DIR)
endef

define Build/Configure
	$(call Build/Configure/Default, \
		--with-firewall="iptables" \
		--with-iptables="/usr/sbin/iptables" \
	)
endef

define Build/Compile
	$(MAKE) -C $(PKG_BUILD_DIR)/ \
	$(TARGET_CONFIGURE_OPTS) \
	CFLAGS="$(TARGET_CFLAGS) -I$(STAGING_DIR)/include-host -I$(STAGING_DIR_HOST)/include -include endian.h  $(TARGET_CFLAGS_EXTRA)" \
	LDFLAGS="$(TARGET_LDFLAGS)"
endef

define Package/sshguard/install
	$(INSTALL_DIR) $(1)/usr/bin
	$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/sshguard $(1)/usr/bin/
endef

$(eval $(call BuildPackage,sshguard))
